layui.use(["element",'table'], function() {
  var element = layui.element;
  var table = layui.table;
  table.render({
    elem: '#table1'
    ,data:vm.tableIns
    ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
    ,cols: [[ //标题栏
      {field: 'id', title: 'ID', width:50}
      ,{field: 'AssetName', title: '资产名称', minWidth: 120}
      ,{field: 'AssetClass', title: '资产类别(大类)', minWidth: 150}
      ,{field: 'CompanyName', title: '企业名称', minWidth: 160}
      ,{field: 'amount', title: '配置金额(万元)', width: 140}
      ,{field: 'proportion', title: '配置比例', width: 100}
      ,{field: 'UpdateTime', title: '更新时间', width: 120}
      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:60}
    ]]
  });
  table.on('tool(demo)', function(obj){
    var data = obj.data;
    if(obj.event === 'detail'){
       if(data.id<2){
         window.location.href = '../DLZCPZMX/CCXQ_1.html';
       }
       else{
        window.location.href = '../DLZCPZMX/CCXQ_2.html';
       }
    } 
  });
});

var vm = new Vue({
  el: '#app',
  data: {
    status:localStorage.getItem('status')?localStorage.getItem('status'):0,
    arr1:['¥ 12,000,000,000','¥ 3,500,000,000','29.17%'],
    tableIns: [{
        "AssetName": "非标资产A1",
        "AssetClass": "非标准债权类资产",
        "CompanyName": "企业A",
        "amount": "100,000",
        "proportion": "20%",
        "UpdateTime": "2018-10-11",
        "id": 1
      },
      {
        "AssetName": "非标资产B1",
        "AssetClass": "非标准债权类资产",
        "CompanyName": "企业B",
        "amount": "250,000",
        "proportion": "36%",
        "UpdateTime": "2018-10-13",
        "id": 2
      }
    ]
  },
  mounted:function(){
    this.init()
  },
  methods: {
    init: function () {
      localStorage.setItem('navigation','<a href="#">首页</a><span lay-separator="">/</span><a href="">投资集中度管理</a><span lay-separator="">/</span><a><cite>所有理财产品投资非标集中度</cite></a>');
      if(this.status == 1){
        this.arr1=['¥ 22,000,000,000','¥ 4,500,000,000','20.45%'];
        this.tableIns = [{
          "AssetName": "非标资产A1",
          "AssetClass": "非标准债权类资产",
          "CompanyName": "企业A",
          "amount": "100,000",
          "proportion": "20%",
          "UpdateTime": "2018-10-11",
          "id": 1
        },
        {
          "AssetName": "非标资产B1",
          "AssetClass": "非标准债权类资产",
          "CompanyName": "企业B",
          "amount": "250,000",
          "proportion": "36%",
          "UpdateTime": "2018-10-13",
          "id": 2
        },
        {
          "AssetName": "非标资产A2",
          "AssetClass": "非标准债权类资产",
          "CompanyName": "企业A",
          "amount": "100,000",
          "proportion": "20%",
          "UpdateTime": "2018-10-13",
          "id": 3
        }]
      }
    }
  }
})